/*
 * c7_review12.cpp
 *
 *  Created on: Sep 1, 2013
 *      Author: cyper.yin
 */

#include <iostream>
using namespace std;
struct applicant {
	char name[30];
	int credit_ratings[3];
};

void display_applicant(applicant);
void display_applicant2(applicant *);


int main_c7r12(int argc, char **argv) {
	applicant app = {"cyper yin", {1,78,23}};
	display_applicant(app);

	display_applicant2(&app);
}

void display_applicant(applicant a){
	cout << "display_applicant:" << endl;;
	cout << a.name << endl;
	int length = sizeof(a.credit_ratings)/sizeof(int);

	for (int i = 0; i < length; ++i) {
		cout << "credit_ratings[i] = " << a.credit_ratings[i]  << endl;
	}

	cout << endl;
}
void display_applicant2(applicant * p){
	cout << "display_applicant2:" << endl;;
		cout << p->name << endl;
		int length = sizeof(p->credit_ratings)/sizeof(int);

		for (int i = 0; i < length; ++i) {
			cout << "credit_ratings[i] = " << p->credit_ratings[i]  << endl;
		}
}



